<template>
  <div class="sp-item">
    <img :src="listData.scene_pic_url" alt />
    <div class="imfo">
      <p class="title">{{listData.title}}</p>
      <div class="sub-title">{{listData.subtitle}}</div>
      <div class="money">{{ listData.price_info | money }}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["listData"],
  data() {
    return {};
  },
  filters: {
    money(val) {
      // 防止异步请求时,延后请求到数据,这里会先报错undefinded
      if (!val) return "￥" + 0 + ".00" + "元";
      return "￥" + val.toFixed(2) + "元";
    }
  },
  methods: {
    clickBtn() {}
  }
};
</script>

<style lang="less" scoped>
.sp-item {
  text-align: center;
  margin-bottom: 10px;
  background-color: #fff;
  img {
    width: 100%;
    // height: 50vw;  // 解决下 不同图片大小统一变成了一样的大小宽高
  }
  .imfo {
    padding: 10px;
    box-sizing: border-box;
    .title {
      margin: 0;
      height: 30px;
      line-height: 30px;
    }
    .sub-title {
      font-size: 12px;
      color: #999;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }
    .money {
      color: #f00;
      font-size: 20px;
    }
  }
}
</style>